home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / gtksourceview-2.0 / language-specs / xml.lang < prev    next >
Extensible Markup Language  |  2009-10-02  |  9KB  |  220 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Authors: Marco Barisione, Emanuele Aina, Paolo Borelli
  5.  Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
  6.  Copyright (C) 2005-2007 Emanuele Aina
  7.  Copyright (C) 2007 Paolo Borelli
  8.  
  9.  This library is free software; you can redistribute it and/or
  10.  modify it under the terms of the GNU Library General Public
  11.  License as published by the Free Software Foundation; either
  12.  version 2 of the License, or (at your option) any later version.
  13.  
  14.  This library is distributed in the hope that it will be useful,
  15.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.  Library General Public License for more details.
  18.  
  19.  You should have received a copy of the GNU Library General Public
  20.  License along with this library; if not, write to the
  21.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22.  Boston, MA 02111-1307, USA.
  23.  
  24. -->
  25. <language id="xml" _name="XML" version="2.0" _section="Markup">
  26.     <metadata>
  27.         <property name="mimetypes">application/xml;text/xml</property>
  28.         <property name="globs">*.xml;*.xspf;*.siv;*.smil;*.smi;*.sml;*.kino;*.xul;*.xbel;*.abw;*.zabw;*.glade;*.jnlp;*.xhtml;*.svg;*.mml;*.rdf;*.rss;*.wml;*.xmi;*.fo;*.xslfo;*.xslt;*.xsl</property>
  29.         <property name="block-comment-start"><!--</property>
  30.         <property name="block-comment-end">--></property>
  31.     </metadata>
  32.  
  33.     <styles>
  34.         <style id="comment"                 _name="Comment"                 map-to="def:comment"/>
  35.         <style id="doctype"                 _name="DOCTYPE"                 map-to="def:preprocessor"/>
  36.         <style id="cdata-delim"             _name="CDATA delimiter"         map-to="def:preprocessor"/>
  37.         <style id="processing-instruction"  _name="Processing instruction"  map-to="def:preprocessor"/>
  38.         <style id="element-name"            _name="Element name"            map-to="def:identifier"/>
  39.         <style id="attribute-name"          _name="Attribute name"          map-to="def:type"/>
  40.         <style id="attribute-value"         _name="Attribute value"         map-to="def:string"/>
  41.         <style id="entity"                  _name="Entity"                  map-to="def:preprocessor"/>
  42.         <style id="tag"                     _name="Tag"/>
  43.         <style id="namespace"               _name="Namespace"               map-to="xml:element-name"/>
  44.         <style id="error"                   _name="Error"                   map-to="def:error"/>
  45.     </styles>
  46.  
  47.     <definitions>
  48.         <define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
  49.  
  50.         <define-regex id="name">[a-zA-Z_][a-zA-Z0-9.:_-]*</define-regex>
  51.  
  52.         <context id="entity" style-ref="entity">
  53.             <match>&\%{name};</match>
  54.         </context>
  55.  
  56.         <context id="character-reference" style-ref="entity">
  57.             <match>&#([0-9]+|x[a-fA-F0-9]+);</match>
  58.         </context>
  59.  
  60.         <context id="unallowed-chars" style-ref="error" extend-parent="false">
  61.             <match>[&<]</match>
  62.         </context>
  63.  
  64.         <context id="comment" style-ref="comment">
  65.             <start><!--</start>
  66.             <end>--></end>
  67.             <include>
  68.                 <context style-ref="error" extend-parent="false">
  69.                     <match>--+</match>
  70.                 </context>
  71.                 <context ref="def:in-comment"/>
  72.             </include>
  73.         </context>
  74.  
  75.         <context id="doctype">
  76.             <start>(<!DOCTYPE)\s+(\%{name})</start>
  77.             <end>></end>
  78.             <include>
  79.               <context sub-pattern="1" where="start" style-ref="doctype"/>
  80.               <context sub-pattern="2" where="start" style-ref="doctype"/>
  81.               <context sub-pattern="0" where="end" style-ref="doctype"/>
  82.               <context>
  83.                 <match>(SYSTEM)\s+(\"[^\"]*\")</match>
  84.                 <include>
  85.                   <context sub-pattern="1" style-ref="doctype"/>
  86.                   <context sub-pattern="2" style-ref="attribute-value"/>
  87.                 </include>
  88.               </context>
  89.               <context>
  90.                 <match>(PUBLIC)\s+(\"[^\"]*\")\s+(\"[^\"]*\")</match>
  91.                 <include>
  92.                   <context sub-pattern="1" style-ref="doctype"/>
  93.                   <context sub-pattern="2" style-ref="attribute-value"/>
  94.                   <context sub-pattern="3" style-ref="attribute-value"/>
  95.                 </include>
  96.               </context>
  97.               <context>
  98.                 <start>\[</start>
  99.                 <end>\]</end>
  100.                 <include>
  101.                   <context sub-pattern="0" where="start" style-ref="doctype"/>
  102.                   <context sub-pattern="0" where="end" style-ref="doctype"/>
  103.                   <context ref="dtd:dtd"/>
  104.                 </include>
  105.               </context>
  106.             </include>
  107.         </context>
  108.  
  109.         <context id="cdata">
  110.             <start><!\[CDATA\[</start>
  111.             <end>\]\]></end>
  112.             <include>
  113.                 <context sub-pattern="0" where="start" style-ref="cdata-delim"/>
  114.                 <context sub-pattern="0" where="end" style-ref="cdata-delim"/>
  115.             </include>
  116.         </context>
  117.  
  118.         <context id="processing-instruction" style-ref="processing-instruction">
  119.             <start><\?</start>
  120.             <end>\?></end>
  121.         </context>
  122.  
  123.         <!-- The following three contexts can be <replace>d in xml
  124.              dialect lang files, to custommize highlighting, e.g.
  125.              highlighting docbook tags as keywords -->
  126.  
  127.         <context id="namespace" style-ref="namespace">
  128.             <match>(?<!:)\%{prefix}:</match>
  129.         </context>
  130.  
  131.         <!-- Match attribute-name before element-name otherwise
  132.              "text" in <fo:block text-align="left"> is detected as
  133.              element -->
  134.         <context id="attribute-name" style-ref="attribute-name">
  135.             <match>\b\%{name}\s*=</match>
  136.         </context>
  137.  
  138.         <context id="attribute-value" style-ref="attribute-value">
  139.             <start>["']</start>
  140.             <end>\%{0@start}</end>
  141.             <include>
  142.                 <context ref="entity"/>
  143.                 <context ref="character-reference"/>
  144.                 <context ref="unallowed-chars"/>
  145.             </include>
  146.         </context>
  147.  
  148.         <context id="element-name" once-only="true" style-ref="element-name">
  149.             <match>\b\%{name}\b(?!\s*=)</match>
  150.         </context>
  151.  
  152.         <context id="prolog">
  153.             <start><\?xml</start>
  154.             <end>\?></end>
  155.             <include>
  156.                 <context sub-pattern="0" where="start" style-ref="processing-instruction"/>
  157.                 <context sub-pattern="0" where="end" style-ref="processing-instruction"/>
  158.                 <context ref="attribute-value"/>
  159.                 <context ref="attribute-name"/>
  160.             </include>
  161.         </context>
  162.  
  163.         <context id="start-tag" style-ref="tag">
  164.             <start><(?!/)</start>
  165.             <end>/?></end>
  166.             <include>
  167.                 <context sub-pattern="0" where="start" style-ref="element-name"/>
  168.                 <context sub-pattern="0" where="end" style-ref="element-name"/>
  169.                 <context ref="entity"/>
  170.                 <context ref="character-reference"/>
  171.                 <context ref="unallowed-chars"/>
  172.                 <context ref="namespace"/>
  173.                 <context ref="attribute-name"/>
  174.                 <context ref="attribute-value"/>
  175.                 <context ref="element-name"/>
  176.                 <context style-ref="error" extend-parent="false">
  177.                   <match>\S</match>
  178.                 </context>
  179.             </include>
  180.         </context>
  181.  
  182.         <context id="end-tag" style-ref="tag">
  183.             <start></</start>
  184.             <end>></end>
  185.             <include>
  186.                 <context sub-pattern="0" where="start" style-ref="element-name"/>
  187.                 <context sub-pattern="0" where="end" style-ref="element-name"/>
  188.                 <context ref="entity"/>
  189.                 <context ref="character-reference"/>
  190.                 <context ref="unallowed-chars"/>
  191.                 <context ref="namespace"/>
  192.                 <context ref="element-name"/>
  193.                 <context style-ref="error" extend-parent="false">
  194.                   <match>\S</match>
  195.                 </context>
  196.             </include>
  197.         </context>
  198.  
  199.         <context id="close-tag-outside-tag" style-ref="error">
  200.           <match>/></match>
  201.         </context>
  202.  
  203.         <context id="xml">
  204.             <include>
  205.                 <context ref="comment"/>
  206.                 <context ref="doctype"/>
  207.                 <context ref="cdata"/>
  208.                 <context ref="prolog"/>
  209.                 <context ref="processing-instruction"/>
  210.                 <context ref="start-tag"/>
  211.                 <context ref="end-tag"/>
  212.                 <context ref="entity"/>
  213.                 <context ref="character-reference"/>
  214.                 <context ref="unallowed-chars"/>
  215.                 <context ref="close-tag-outside-tag"/>
  216.             </include>
  217.         </context>
  218.     </definitions>
  219. </language>
  220.